package com.aoxin.util.enumerate;

import com.aoxin.util.ErrorUtil;

/**
 * 考勤类型
 * 
 * @author Melody
 * @date 2018年4月7日 下午8:06:14
 */
public enum AttendanceType {
	NORMAL(1, "正常"), ARRIVE_LATE(2, "迟到"), LEAVE_EARLY (3, "早退");

	private int id;

	private String value;

	private AttendanceType(int id, String value) {
		this.id = id;
		this.value = value;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public static AttendanceType fromId(int id) {
		switch (id) {
		case 1:
			return NORMAL;
		case 2:
			return ARRIVE_LATE;
		case 3:
			return LEAVE_EARLY;
		}
		throw new RuntimeException(String.format(ErrorUtil.OPERATE_TYPE, id));
	}
}
